package in.rkvsraman.gmailgadgets.simplegadget.client;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArrayString;

public class ClippyJS {
	public static final JavaScriptObject Agent = null;

	static public final native void create(String name) /*-{

		//	$wnd.clippy.load(name);
		$wnd.loaded = false;
		$wnd.ag = null;

		$wnd.clippy.load(name, function(agent1) {
			// do anything with the loaded agent
			agent1.show();
			$wnd.ag = agent1;
			$wnd.loaded = true;

		});

	}-*/;

	static public final native void play(String animation) /*-{

		//Agent = $wnd.agent;
		$wnd.ag.play(animation);

	}-*/;

	static public final native JavaScriptObject isLoaded() /*-{

		//Agent = $wnd.agent;
		return $wnd.loaded;

	}-*/;

	static public final native void speak(String text) /*-{

		//Agent = $wnd.agent;
		$wnd.ag.speak(text);

	}-*/;

	static public final native void moveTo(int x, int y) /*-{

		//Agent = $wnd.agent;
		$wnd.ag.moveTo(x, y);

	}-*/;

	static public final native void gestureAt(int x, int y) /*-{

		//Agent = $wnd.agent;
		$wnd.ag.gestureAt(x, y);

	}-*/;

	static public final native JsArrayString animations() /*-{

		//Agent = $wnd.agent;
		return $wnd.ag.animations();

	}-*/;

	static public final native void stop() /*-{

		//Agent = $wnd.agent;
		$wnd.ag.stop();

	}-*/;

	static public final native void hide() /*-{

		//Agent = $wnd.agent;
		$wnd.ag.hide();

	}-*/;

}
